clear all

*================= Formatting =================*
/* Sets Latex fonts for outputting graphs for paper */
/* Switch to Sans if outputting for presentations */
*graph set window fontfacesans   "LM Sans 12"
graph set window fontface   "LM Roman 10"
*graph set window fontfaceserif  "LM Roman 10"
*graph set svg fontfacesans   "LM Sans 12"
graph set svg fontface   "LM Roman 10"
*graph set svg fontfaceserif  "LM Roman 10"
//* When outputting, "graph export "NAME.svg", replace as(svg)"
/* Sets a simple mono scheme */
/* Should still be able to specify colors in a graph command */
set scheme s1mono

use "$data/2_field_experiment/final_data/MayJuly2022_merged_norms.dta", clear

*==================== Balance =========================*
		gen Elementary=(gradestatus=="Elementary")
			replace Elementary=1 if highgrade=="PK"&gradestatus=="NA"
			replace Elementary=1 if highgrade=="KG"&gradestatus=="NA"
			replace Elementary=1 if highgrade=="1"&gradestatus=="NA"	
			replace Elementary=1 if highgrade=="2"&gradestatus=="NA"		
			replace Elementary=1 if highgrade=="3"&gradestatus=="NA"		
			replace Elementary=1 if highgrade=="4"&gradestatus=="NA"		
			replace Elementary=1 if highgrade=="5"&gradestatus=="NA"
			replace Elementary=1 if highgrade=="PK"&gradestatus==""
			replace Elementary=1 if highgrade=="KG"&gradestatus==""
			replace Elementary=1 if highgrade=="1"&gradestatus==""	
			replace Elementary=1 if highgrade=="2"&gradestatus==""		
			replace Elementary=1 if highgrade=="3"&gradestatus==""		
			replace Elementary=1 if highgrade=="4"&gradestatus==""		
			replace Elementary=1 if highgrade=="5"&gradestatus==""			
			
			
		gen K12=(gradestatus=="K-12")
			replace K12=1 if highgrade=="12"&lowgrade=="K"&gradestatus=="NA"
			replace K12=1 if highgrade=="12"&lowgrade=="K"&gradestatus==""
			
		gen Middle=(gradestatus=="Middle")	
			replace Middle=1 if highgrade=="8"&gradestatus=="NA"
			replace Middle=1 if highgrade=="7"&gradestatus=="NA"
			replace Middle=1 if highgrade=="6"&gradestatus=="NA"
			replace Middle=1 if highgrade=="8"&gradestatus==""
			replace Middle=1 if highgrade=="7"&gradestatus==""
			replace Middle=1 if highgrade=="6"&gradestatus==""			
			
		gen High=(gradestatus=="High")		
			replace High=1 if highgrade=="9"&gradestatus=="NA"
			replace High=1 if highgrade=="10"&gradestatus=="NA"
			replace High=1 if highgrade=="11"&gradestatus=="NA"	
			replace High=1 if highgrade=="12"&gradestatus=="NA"
			replace High=1 if highgrade=="9"&gradestatus==""
			replace High=1 if highgrade=="10"&gradestatus==""
			replace High=1 if highgrade=="11"&gradestatus==""	
			replace High=1 if highgrade=="12"&gradestatus==""			
			
		gen K_PK=0
				replace K_PK=1 if lowgrade=="PK"&highgrade=="K"&gradestatus=="NA"
				replace K_PK=1 if lowgrade=="K"&highgrade=="K"&gradestatus=="NA"
				replace K_PK=1 if lowgrade=="PK"&highgrade=="K"&gradestatus==""
				replace K_PK=1 if lowgrade=="K"&highgrade=="K"&gradestatus==""
				
				
		gen PublicCharter = (whetheracharterschool=="Yes") 
		gen PublicNOTCharter = (whetheracharterschool=="No")
			replace PublicNOTCharter=1 if public==1&whetheracharterschool==""
		gen Private=(whetheracharterschool=="NA") 
			replace Private=1 if public==0&whetheracharterschool==""
			
		gen Religious=1 if Private==1
			replace Religious=0 if Private==1&schooltypology=="Nonsectarian, regular school"
			replace Religious=0 if Private==1&schooltypology=="Nonsectarian, special education"
			replace Religious=0 if Private==1&schooltypology=="Nonsectarian, special program"
			

		destring totalstudents, force replace
		destring totaloffreeluncheligibleandreduc, force replace

		gen FreeLunch= totaloffreeluncheligibleandreduc/totalstudents
			replace FreeLunch=. if FreeLunch<0
			
		destring allstudentswhite allstudentsblack allstudentsasian allstudentshispanic allstudentstwoormoreraces, force replace
			
		gen White=allstudentswhite/totalstudents
			replace White=. if White<0
		gen Black=allstudentsblack/totalstudents
			replace Black=. if Black<0
		gen Asian=allstudentsasian/totalstudents
			replace Asian=. if Asian<0
		gen Hispanic=allstudentshispanic/totalstudents
			replace Hispanic=. if Hispanic<0	
			
		label var PublicCharter "Public (Charter)"
		label var PublicNOTCharter "Public (non-Charter)"
		label var FreeLunch "Free Lunch"


gen RelVPrivPub=.
			replace RelVPrivPub=1 if Religious==1
			replace RelVPrivPub=0 if Religious!=1&PublicCharter!=1
	label define RelVPrivPubl ///
		0 "Public/Private (No Charter)" ///
		1 "Relgious", modify
	label values RelVPrivPub RelVPrivPubl		
sum sexism_index, detail			
gen sexism_10v90th=.
	replace sexism_10v90th=0 if sexism_index<= -.6941619 & sexism_index!=.
	replace sexism_10v90th=1 if sexism_index>= 1.337555 & sexism_index!=.
	label define sexism_10v90thl ///
		0 "<10pctile sexist		" ///
		1 ">90pctile sexist		", modify
	label values sexism_10v90th sexism_10v90thl				

gen sexism_25v75th=.
	replace sexism_25v75th=0 if sexism_index<=  -.4615303 & sexism_index!=.
	replace sexism_25v75th=1 if sexism_index>= .4213378 & sexism_index!=.
	label define sexism_25v75thl ///
		0 "<25pctile sexist" ///
		1 ">75pctile sexist"
	label values sexism_25v75th sexism_25v75thl					
	
sum republican_voteshare_16, detail
gen Repub_10v90th=.
	replace Repub_10v90th=0 if republican_voteshare_16<= .2241334& republican_voteshare_16!=.
	replace Repub_10v90th=1 if republican_voteshare_16>= .719804& republican_voteshare_16!=.
	label define Repub_10v90thl ///
		0 "<10pctile Republican		" ///
		1 ">90pctile Republican		", modify
	label values Repub_10v90th Repub_10v90thl		
gen Repub_25v75th=.
	replace Repub_25v75th=0 if republican_voteshare_16<=  .3464484& republican_voteshare_16!=.
	replace Repub_25v75th=1 if republican_voteshare_16>= .6052088& republican_voteshare_16!=.
	label define Repub_25v75thl ///
		0 "<25pctile Republican" ///
		1 ">75pctile Republican"
	label values Repub_25v75th Repub_25v75thl	

gen M_F_wageRatio=malemedianwage/femalemedianwage 	
sum M_F_wageRatio, detail	 
gen M_F_wage_10v90th=.
	replace M_F_wage_10v90th=0 if M_F_wageRatio<= 1.241831& M_F_wageRatio!=.
	replace M_F_wage_10v90th=1 if M_F_wageRatio>= 1.639185& M_F_wageRatio!=.
	label define M_F_wage_10v90thl ///
		0 "<10pctile M/F wage ratio	" ///
		1 ">90pctile M/F wage ratio	", modify
	label values M_F_wage_10v90th M_F_wage_10v90thl	
	
gen M_F_wage_25v75th=.
	replace M_F_wage_25v75th=0 if M_F_wageRatio<= 1.30134& M_F_wageRatio!=.
	replace M_F_wage_25v75th=1 if M_F_wageRatio>= 1.514815& M_F_wageRatio!=.
	label define M_F_wage_25v75thl ///
		0 "<25pctile M/F wage ratio" ///
		1 ">75pctile M/F wage ratio"
	label values M_F_wage_25v75th M_F_wage_25v75thl		
	
gen M_F_LFRatio=laborforcemale_perc/laborforcefem_perc
sum M_F_LFRatio, detail		

gen M_F_LFRatio_10v90th=.
	replace M_F_LFRatio_10v90th=0 if M_F_LFRatio<= 1.089811& M_F_LFRatio!=.
	replace M_F_LFRatio_10v90th=1 if M_F_LFRatio>=1.237038& M_F_LFRatio!=.
	label define M_F_LFRatio_10v90thl ///
		0 "<10pctile M/F labor force ratio" ///
		1 ">90pctile M/F labor force ratio"
	label values M_F_LFRatio_10v90th M_F_LFRatio_10v90thl
	
gen M_F_LFRatio_25v75th=.
	replace M_F_LFRatio_25v75th=0 if M_F_LFRatio<= 1.126604& M_F_LFRatio!=.
	replace M_F_LFRatio_25v75th=1 if M_F_LFRatio>= 1.205096& M_F_LFRatio!=.
	label define M_F_LFRatio_25v75thl ///
		0 "<25pctile M/F labor force ratio" ///
		1 ">75pctile M/F labor force ratio"
	label values M_F_LFRatio_25v75th M_F_LFRatio_25v75thl
	
gen DM_Female=(genderofprincipal=="F")
	label define DM_Femalel ///
		0 "DM Male" ///
		1 "DM Female"
	label values DM_Female DM_Femalel	
	

gen MoreRural=.
	replace MoreRural=1 if (rural_level>3&rural_level!=.)
	replace MoreRural=0 if (rural_level==1|rural_level==2|rural_level==3)
	label define MoreRurall ///
		0 "Metro Area             " ///
		1 "Rural Area			", modify
	label values MoreRural MoreRurall	
	
sum totalreligiousadherence, detail
gen RelgAdhere_25v75th=.
	replace RelgAdhere_25v75th=0 if totalreligiousadherence<= 39.75789& totalreligiousadherence!=.
	replace RelgAdhere_25v75th=1 if totalreligiousadherence>= 57.17& totalreligiousadherence!=.
	label define RelgAdhere_25v75thl ///
		0 "<25pctile Relg Attnd" ///
		1 ">75pctile Relg Attnd"
	label values RelgAdhere_25v75th RelgAdhere_25v75thl
	
gen RelgAdhere_10v90th=.
	replace RelgAdhere_10v90th=0 if totalreligiousadherence<=  33.78189& totalreligiousadherence!=.
	replace RelgAdhere_10v90th=1 if totalreligiousadherence>= 64.89289& totalreligiousadherence!=.
	label define RelgAdhere_10v90thl ///
		0 "<10pctile Relg Attnd" ///
		1 ">90pctile Relg Attnd"
	label values RelgAdhere_10v90th RelgAdhere_10v90thl	
	
global balance_stats_vars "Elementary Middle High DMFem PublicCharter PublicNOTCharter Private FreeLunch  White Black Hispanic FemaleEmail"
*================= Weighing =================*

bysort Variation Treatment: egen temp_weightF=total(FemaleEmail)
bysort Variation Treatment: gen temp_weightAll=_N
gen temp_weightM=temp_weightAll-temp_weightF
gen tempF_a_weight=temp_weightAll/temp_weightF*.5 if FemaleEmail==1
	replace tempF_a_weight=temp_weightAll/temp_weightM*.5 if FemaleEmail==0	
	
bysort Variation: gen temp_weightTreat=_N
gen weightTreat=temp_weightTreat/temp_weightAll/5	

gen a_weight=tempF_a_weight*weightTreat	
gen p_weight=a_weight
	
gen temp_f_weight=a_weight* temp_weightF * temp_weightM  
	gen f_weight=round(temp_f_weight, 1)
drop temp*	

bysort Variation Treatment FemaleEmail: gen temp_NumGenderEmail=_N
bysort Variation : egen temp_Lowest_NumGenderEmail=min(temp_NumGenderEmail)
bysort Variation Treatment : gen temp_NumFemEmail=temp_NumGenderEmail if FemaleEmail==1
bysort Variation Treatment : egen NumFemEmail=min(temp_NumFemEmail) 
bysort Variation Treatment : gen temp_NumMaleEmail=temp_NumGenderEmail if FemaleEmail==0
bysort Variation Treatment : egen NumMaleEmail=min(temp_NumMaleEmail) 

gen temp_Num_Drop=temp_NumGenderEmail-temp_Lowest_NumGenderEmail
gen PropDrop=temp_Num_Drop/temp_NumGenderEmail

set seed 223
gen rand_w=runiform()

gen AltDataSet=1
	replace AltDataSet=0 if PropDrop>0&PropDrop>=rand_w

	
drop temp_NumGenderEmail temp_Lowest_NumGenderEmail temp_NumFemEmail NumFemEmail temp_NumMaleEmail NumMaleEmail temp_Num_Drop PropDrop rand_w weightTreat

//--------------- FemalePrincipal Weighting

bysort Variation Treatment FemalePrincipal: egen temp_weightF=total(FemaleEmail)
bysort Variation Treatment FemalePrincipal: gen temp_weightAll=_N
gen temp_weightM=temp_weightAll-temp_weightF
gen tempF_a_weight=temp_weightAll/temp_weightF*.5 if FemaleEmail==1
	replace tempF_a_weight=temp_weightAll/temp_weightM*.5 if FemaleEmail==0	
	
bysort Variation: gen temp_weightTreat=_N
gen weightTreat=temp_weightTreat/temp_weightAll/5	

gen a_weight_PrinGen=tempF_a_weight*weightTreat	
gen p_weight_PrinGen=a_weight_PrinGen
	
gen temp_f_weight=a_weight_PrinGen* temp_weightF * temp_weightM 
	gen f_weight_PrinGen=round(temp_f_weight, 1)
drop temp*

gen Main= treatment=="Main"|treatment=="Main Audrey high" |treatment=="Main Audrey low" |treatment=="Main Curtis high" |treatment=="Main Curtis low" |treatment=="Main Erica high" |treatment=="Main Erica low" |treatment=="Main Roy high" |treatment=="Main Roy low"
gen Exp= treatment=="Constant Expertise"| treatment=="Constant Expertise Audrey high"| treatment=="Constant Expertise Audrey low"| treatment=="Constant Expertise Curtis high"| treatment=="Constant Expertise Curtis low"| treatment=="Constant Expertise Erica high"| treatment=="Constant Expertise Erica low"| treatment=="Constant Expertise Roy high"| treatment=="Constant Expertise Roy low"
gen Pay= treatment=="Payment"|treatment=="Payment Audrey high" |treatment=="Payment Audrey low" |treatment=="Payment Curtis high" |treatment=="Payment Curtis low" |treatment=="Payment Erica high" |treatment=="Payment Erica low" |treatment=="Payment Roy high" |treatment=="Payment Roy low"
gen FT= Main==0 & Exp==0 & Pay==0


gen outcome=.
	replace outcome=0 if FemaleNum==.
	replace outcome=1 if FemaleNum==1
	replace outcome=2 if FemaleNum==0
	
label define outcomel ///
	0 "No Call" ///
	1 "Female Call" ///
	2 "Male Call"
label values outcome outcomel
	
gen Baseline=(Treatment==0)	
gen MaleHigh=(Treatment==1)
gen MaleLow=(Treatment==2)
gen FemaleHigh=(Treatment==3)
gen FemaleLow=(Treatment==4)	

label var FemaleNum0 "Called Female"
label var MaleNum0 "Called Male"
label var NoCall "No Call"

label var FemaleNum "Called Female $|$ Call"
label var MaleNum "Called Male $|$ Call"

label var MaleHigh "High Male (Hm)"
label var MaleLow "Low Male (Lm)"
label var FemaleHigh "High Female (Hf)"
label var FemaleLow "Low Female (Lf)"


gen DMFem=(genderofprincipal=="F")
	label var DMFem "Decison-Maker Female"
	label define DMFeml ///
		1 "F Decider" ///
		0 "M Decider"
	label values DMFem DMFeml
		
drop order 
rename treatment treatmentOld	

gen order=0 if Treatment==1 // Male High Availability
		replace order=1 if Treatment==4 //Female Low Availability
		replace order=2 if Treatment==0 //Baseline
		replace order=3 if Treatment==2	//Male Low Availability
		replace order=4 if Treatment==3	//Female High Availability	
	
label define OrderTreatl ///
	0 "Male High Availability" ///
	1 "Female Low Availability" ///	
	2 "No Signal" ///
	3 "Male Low Availability"	///
	4 "Female High Availability" 
	
label values order OrderTreatl 	

//--------- Set Globals
global Var "Main Pay Exp FT"
global sum_stats_vars "FemaleNum0 MaleNum0 NoCall FemaleNum MaleNum FemaleEmail"
global treat_vars "MaleHigh FemaleLow MaleLow FemaleHigh"
	* set decimal places to round
	global dec=2
	global control_vars "FemaleEmail"
destring duration, force replace
svyset [pweight=p_weight]

//--------- Balance

estimates clear
	
set sortseed 223	
gen rand_w=runiform()

//--------- Weighting
*Ideal: Equal number from FemaleEmail by Variation/Treatment
*Reality: imbalances on FemailEmail
drop weightTreat
global SubSet "RelVPrivPub sexism_10v90th Repub_10v90th M_F_wage_10v90th M_F_LFRatio_10v90th sexism_25v75th Repub_25v75th M_F_wage_25v75th M_F_LFRatio_25v75th DM_Female MoreRural RelgAdhere_25v75th RelgAdhere_10v90th Elementary Middle High"
foreach sub in $SubSet{
bysort Variation Treatment `sub': egen temp_weightF=total(FemaleEmail)
bysort Variation Treatment `sub': gen temp_weightAll=_N
gen temp_weightM=temp_weightAll-temp_weightF
gen tempF_a_weight=temp_weightAll/temp_weightF*.5 if FemaleEmail==1
	replace tempF_a_weight=temp_weightAll/temp_weightM*.5 if FemaleEmail==0	

bysort Variation `sub': gen temp_weightTreat=_N
gen weightTreat=temp_weightTreat/temp_weightAll/5

gen a_weight_`sub'=tempF_a_weight*weightTreat	
gen p_weight_`sub'=a_weight_`sub'

bysort Variation Treatment FemaleEmail `sub': gen temp_NumGenderEmail=_N
bysort Variation `sub': egen temp_Lowest_NumGenderEmail=min(temp_NumGenderEmail)
bysort Variation Treatment `sub': gen temp_NumFemEmail=temp_NumGenderEmail if FemaleEmail==1
bysort Variation Treatment `sub': egen NumFemEmail=min(temp_NumFemEmail) 
bysort Variation Treatment `sub': gen temp_NumMaleEmail=temp_NumGenderEmail if FemaleEmail==0
bysort Variation Treatment `sub': egen NumMaleEmail=min(temp_NumMaleEmail) 

gen temp_Num_Drop=temp_NumGenderEmail-temp_Lowest_NumGenderEmail
gen PropDrop=temp_Num_Drop/temp_NumGenderEmail

gen AltDataSet_`sub'=1
	replace AltDataSet_`sub'=0 if PropDrop>0&PropDrop>=rand_w

	
drop temp_NumGenderEmail temp_NumFemEmail NumFemEmail temp_NumMaleEmail weightTreat NumMaleEmail PropDrop

tabstat FemaleNum0 MaleNum0 NoCall FemaleNum MaleNum FemaleEmail [aweight=a_weight_`sub'] if Variation==0, by(`sub') stat(mean N)

tabstat FemaleNum0 MaleNum0 NoCall FemaleNum MaleNum FemaleEmail if Variation==0&AltDataSet_`sub'==1, by(`sub') stat(mean N)

tabstat FemaleNum0 MaleNum0 NoCall FemaleNum MaleNum FemaleEmail [aweight=a_weight_`sub'] if Variation==0&Treatment==0, by(`sub') stat(mean N)
drop temp*	
}	


*============= Analysis primary dataset ==============*

cd "$output"
// Table 1: Summary Statistics by Treatment in Baseline & Equal Decision Variation 
forvalues i=0/4 {
svy: mean FemaleNum0 MaleNum0 NoCall if Treatment==`i'&Main==1 
estimates store M_T`i'_All
svy: mean FemaleNum MaleNum if Treatment==`i'&Main==1 
estimates store M_T`i'_Cond
}
	*************************************************************
	* svy: mean FemaleNum0 MaleNum0 NoCall if Treatment==0&Main==1 
	* .0984024, .0709156, .830682 //  5,612 obs, PSU:  5,612
	* 
	* In ided data: 
	*  .1211141,  .0830453,  .7958407 //5,612 obs, PSU:  5,612
	**************************************************************
esttab M_T1_All M_T4_All M_T0_All M_T2_All M_T3_All using "$tables/Table1_PanelAi.tex", label nodepvars nostar mtitle("High Male" "Low Female" "No Signal" "Low Male" "High Female") cells( b(fmt(2)) se( par )) collabels(none) replace 
esttab M_T1_Cond M_T4_Cond M_T0_Cond M_T2_Cond M_T3_Cond using "$tables/Table1_PanelAii.tex", se label nodepvars nostar mtitle("High Male" "Low Female" "No Signal" "Low Male" "High Female") cells( b(fmt(2)) se( par )) collabels(none) replace

forvalues i=0/4 {
svy: mean FemaleNum0 MaleNum0 NoCall if Treatment==`i'&Exp==1 
estimates store Exp_T`i'_All
svy: mean FemaleNum MaleNum if Treatment==`i'&Exp==1 
estimates store Exp_T`i'_Cond
}

esttab Exp_T1_All Exp_T4_All Exp_T0_All Exp_T2_All Exp_T3_All using "$tables/Table1_PanelBi.tex", label nodepvars nostar mtitle("High Male" "Low Female" "No Signal" "Low Male" "High Female") cells( b(fmt(2)) se( par )) collabels(none) replace 

esttab Exp_T1_Cond Exp_T4_Cond Exp_T0_Cond Exp_T2_Cond Exp_T3_Cond using "$tables/Table1_PanelBii.tex", se label nodepvars nostar mtitle("High Male" "Low Female" "No Signal" "Low Male" "High Female") cells( b(fmt(2)) se( par )) collabels(none) replace 

cd "$output"
// Figure 3: Outcomes by Treatment
	graph bar (mean) FemaleNum0 (mean) MaleNum0 (mean) NoCall [aweight=a_weight] if Variation==0|Variation==2, over(Variation, label(angle(50))) over(Treatment, gap(*1) sort(order) relabel(1 "No Signal" 2 `" "High Male" "Availability" "' 3 `" "Low Male" "Availability" "' 4 `" "High Female" "Availability" "' 5 `""Low Female" "Availability""') label(angle(0))) stack bar(1, fcolor(orange) lcolor(orange)) bar(2, fcolor(ltblue%70) lcolor(ltblue)) bar(3, fcolor(green) lcolor(green)) ytitle(Proportion) ylab(,nogrid) legend(order(1 "Called Female (Mom)" 2 "Called Male (Dad)" 3 "No Call") row(1))	
			graph export "$figures/Figure_3_a.png", as(png) replace	

graph bar (mean) FemaleNum (mean) MaleNum [aweight=a_weight] if Variation==0|Variation==2, yline(0.5) over(Variation, label(angle(50))) over(Treatment, gap(*1) sort(order) relabel(1 "No Signal" 2 `" "High Male" "Availability" "' 3 `" "Low Male" "Availability" "' 4 `" "High Female" "Availability" "' 5 `""Low Female" "Availability""') label(angle(0))) stack bar(1, fcolor(orange) lcolor(orange)) bar(2, fcolor(ltblue%70) lcolor(ltblue)) title() ytitle(Proportion) ylab(,nogrid) legend(order(1 "Called Female (Mom)" 2 "Called Male (Dad)"))
		graph export "$figures/Figure_3_b.png", as(png) replace
	
cd "$output"
// Table 2: Summary Statistics by Primary Email Sender
forvalues f=0/1 {
	svy: mean FemaleNum0 MaleNum0 NoCall if Main==1&FemaleEmail==`f' 
	estimates store M_All_f`f'
	svy: mean FemaleNum MaleNum if Main==1&FemaleEmail==`f' 
	estimates store M_Cond_f`f'
forvalues i=0/4 {
svy: mean FemaleNum0 MaleNum0 NoCall if Treatment==`i'&Main==1&FemaleEmail==`f' 
estimates store M_T`i'_All_f`f'
svy: mean FemaleNum MaleNum if Treatment==`i'&Main==1&FemaleEmail==`f' 
estimates store M_T`i'_Cond_f`f'
}
esttab M_All_f`f' M_T1_All_f`f' M_T4_All_f`f' M_T0_All_f`f' M_T2_All_f`f' M_T3_All_f`f' using "$tables/Table2_A1_`f'.tex", label nodepvars nostar mtitle("All Msgs." "High Male (Hm)" "Low Female (Lf)" "Baseline (b)" "Low Male (Lm)" "High Female (Hf)") cells( b(fmt(2)) se( par )) collabels(none) replace 

esttab M_Cond_f`f' M_T1_Cond_f`f' M_T4_Cond_f`f' M_T0_Cond_f`f' M_T2_Cond_f`f' M_T3_Cond_f`f' using "$tables/Table2_A2_`f'.tex", se label nodepvars nostar mtitle("All Msgs." "High Male (Hm)" "Low Female (Lf)" "Baseline (b)" "Low Male (Lm)" "High Female (Hf)") cells( b(fmt(2)) se( par )) collabels(none) replace 

}

sum FemaleNum [aweight=a_weight] if Main==1&FemaleEmail==1&Treatment==0 //Baseline 98%
sum FemaleNum [aweight=a_weight] if Main==1&FemaleEmail==1&Treatment==2 //Male Low 97%
	//Baseline vs. Male Low
	ttesti 647    .9752705   .1554198 626    .956869    .2033144  // Pr(|T| > |t|) = 0.0693
sum FemaleNum [aweight=a_weight] if Main==1&FemaleEmail==1&Treatment==3 //Female High 96%
	//Baseline vs. Female High
	ttesti 347    .9752705   .1554198 659    .9711684    .16746   // Pr(|T| > |t|) = 0.7052

cd "$output"
forvalues f=0/1 {
	svy: mean FemaleNum0 MaleNum0 NoCall if Exp==1&FemaleEmail==`f' 
	estimates store Exp_All_f`f'
	svy: mean FemaleNum MaleNum if Exp==1&FemaleEmail==`f' 
	estimates store Exp_Cond_f`f'
forvalues i=0/4 {
svy: mean FemaleNum0 MaleNum0 NoCall if Treatment==`i'&Exp==1&FemaleEmail==`f' 
estimates store Exp_T`i'_All_f`f'
svy: mean FemaleNum MaleNum if Treatment==`i'&Exp==1&FemaleEmail==`f' 
estimates store Exp_T`i'_Cond_f`f'
}
esttab Exp_All_f`f' Exp_T1_All_f`f' Exp_T4_All_f`f' Exp_T0_All_f`f' Exp_T2_All_f`f' Exp_T3_All_f`f' using "$tables/Table2_B1_`f'.tex", label nodepvars nostar mtitle("All Msgs." "High Male (Hm)" "Low Female (Lf)" "Baseline (b)" "Low Male (Lm)" "High Female (Hf)") cells( b(fmt(2)) se( par )) collabels(none) replace 

esttab Exp_Cond_f`f' Exp_T1_Cond_f`f' Exp_T4_Cond_f`f' Exp_T0_Cond_f`f' Exp_T2_Cond_f`f' Exp_T3_Cond_f`f' using "$tables/Table2_B2_`f'.tex", se label nodepvars nostar mtitle("All Msgs." "High Male (Hm)" "Low Female (Lf)" "Baseline (b)" "Low Male (Lm)" "High Female (Hf)") cells( b(fmt(2)) se( par )) collabels(none) replace 

}


//Figure 4: Differences in Gender Gap by Gender Norm Proxies With No Signal Message in Baseline
reg FemaleNum0 [aweight=a_weight_RelVPrivPub] if Main==1&Treatment==0&RelVPrivPub==1
reg MaleNum0 [aweight=a_weight_RelVPrivPub] if Main==1&Treatment==0&RelVPrivPub==1

	label define RelVPrivPubl ///
		0 "_   Public/Private (No Charter)" ///
		1 "Relgious", modify
	label values RelVPrivPub RelVPrivPubl		
	
	label define Repub_10v90thl ///
		0 "<10pctile Republican" ///
		1 ">90pctile Republican		", modify
	label values Repub_10v90th Repub_10v90thl		
	
	label define M_F_wage_10v90thl ///
		0 "<10pctile M/F wage ratio" ///
		1 ">90pctile M/F wage ratio", modify
	label values M_F_wage_10v90th M_F_wage_10v90thl	
	
	label define MoreRurall ///
		0 "Less Rural Area " ///
		1 "Rural Area", modify
	label values MoreRural MoreRurall	

	label define RelgAdhere_10v90thl ///
		0 "<10pctile Religious Attendace" ///
		1 ">90pctile Religious Attendace", modify
	label values RelgAdhere_10v90th RelgAdhere_10v90thl	

reg FemaleNum0 RelVPrivPub [aweight=a_weight_RelVPrivPub] if Main==1&Treatment==0

graph bar (mean) MaleNum0 (mean) FemaleNum0 [aweight = a_weight_RelVPrivPub] if Main==1&Treatment==0,  over(RelVPrivPub, label( angle(90))) bar(1, fcolor(ltblue)) bar(2, fcolor(orange)) legend (label(1 "Male") label(2 "Female")) text(.2 50 "p=0.000",  ) ylabel(0.0000(0.0500)0.2200) yscale(range(0 .25)) 
graph save "$figures/temp/Graph1.gph", replace

reg FemaleNum0 Repub_10v90th [aweight=a_weight_Repub_10v90th] if Main==1&Treatment==0
graph bar (mean) MaleNum0 (mean) FemaleNum0 [aweight = a_weight_Repub_10v90th],  over(Repub_10v90th, label( angle(90))) bar(1, fcolor(ltblue)) bar(2, fcolor(orange)) legend(off)  text(.2 50 "p=0.006",  ) ylabel(0.0000(0.0500)0.2200)  yscale(range(0 .25))
graph save "$figures/temp/Graph2.gph", replace

reg FemaleNum0 MoreRural [aweight=a_weight_MoreRural] if Main==1&Treatment==0
graph bar (mean) MaleNum0 (mean) FemaleNum0 [aweight = a_weight_MoreRural], over(MoreRural, label( angle(90))) bar(1, fcolor(ltblue)) bar(2, fcolor(orange)) legend(off) text(.2 50 "p=0.033",  ) yscale(range(0 .25))
graph save "$figures/temp/Graph4.gph", replace

reg FemaleNum0 RelgAdhere_10v90th [aweight=a_weight_RelgAdhere_10v90th] if Main==1&Treatment==0
graph bar (mean) MaleNum0 (mean) FemaleNum0 [aweight = a_weight_RelgAdhere_10v90th], over(RelgAdhere_10v90th, label( angle(90))) bar(1, fcolor(ltblue)) bar(2, fcolor(orange)) legend(off) text(.2 50 "p=0.597",  ) ylabel(0.0000(0.0500)0.2200) yscale(range(0 .25))
graph save "$figures/temp/Graph5.gph", replace

* Note: This figure was edited ex-post to match the current output appearing in the draft
grc1leg "$figures/temp/Graph1.gph" "$figures/temp/Graph2.gph" "$figures/temp/Graph4.gph" "$figures/temp/Graph5.gph", rows(1) imargin(0 0 0 0) ysize(2) xsize(7) 
	graph export "$figures/Figure4.png", as(png) replace 

estimates clear

* ----------- Table 3: Summary Statistics by Variation (All Treatments Combined) -------- *
foreach var in $Var {
svy: mean FemaleNum0 MaleNum0 NoCall if `var'==1 
estimates store `var'_All
svy: mean FemaleNum MaleNum if `var'==1  
estimates store `var'_Cond
}

// Gender Norms
global sum_stats_vars "FemaleNum0 MaleNum0 NoCall FemaleNum MaleNum" 
global SubSet "RelVPrivPub sexism_10v90th sexism_25v75th Repub_10v90th Repub_25v75th M_F_wage_25v75th M_F_wage_10v90th M_F_LFRatio_25v75th M_F_LFRatio_10v90th DM_Female MoreRural RelgAdhere_25v75th RelgAdhere_10v90th"
global MainExp "Main Exp"

* Export Table 3
esttab Main_All Exp_All FT_All Pay_All using "$tables/Table_3_A.tex", label nodepvars nostar mtitle("Main" "Equal Decision" "Full Time" "Payments") cells( b(fmt(3)) se( par )) collabels(none) replace 
esttab Main_Cond Exp_Cond FT_Cond Pay_Cond using "$tables/Table_3_B.tex", label nodepvars nostar mtitle("Main" "Equal Decision" "Full Time" "Payments") cells( b(fmt(3)) se( par )) collabels(none) replace


* -------------------------------- Table A5-A6 ----------------------------- *

foreach var in $MainExp{
foreach sub in $SubSet{
eststo `var'`sub'_h: estpost sum $sum_stats_vars [aweight=a_weight_`sub'] if `var'==1&`sub'==0
eststo `var'`sub'_l: estpost sum $sum_stats_vars [aweight=a_weight_`sub'] if `var'==1&`sub'==1

eststo `var'`sub'_Bh: estpost sum $sum_stats_vars [aweight=a_weight_`sub'] if `var'==1&Treatment==0&`sub'==0
eststo `var'`sub'_Bl: estpost sum $sum_stats_vars [aweight=a_weight_`sub'] if `var'==1&Treatment==0&`sub'==1
}

local filename = cond("`var'" == "Main", "Table_A5", "Table_A6")
cd "$output/tables"
esttab `var'RelVPrivPub_Bh `var'RelVPrivPub_Bl `var'Repub_10v90th_Bh `var'Repub_10v90th_Bl `var'M_F_wage_10v90th_Bh `var'M_F_wage_10v90th_Bl `var'MoreRural_Bh `var'MoreRural_Bl  `var'RelgAdhere_10v90th_Bh `var'RelgAdhere_10v90th_Bl `var'sexism_10v90th_Bh `var'sexism_10v90th_Bl  using "`filename'.tex", label  nodepvars collabels(none) mtitle("\Centerstack{Non \! Religious \! School}" "\Centerstack{Religious \! School}" "\Centerstack{Low \! Repub. \! County}" "\Centerstack{High \! Repub. \! County}" "\Centerstack{Small \! Wage \! Gap \! County}" "\Centerstack{Large \! Wage \! Gap \! County}"  "\Centerstack{Less \! Rural \! County }" "\Centerstack{More \! Rural \! County}" "\Centerstack{Less \! Religious \! County}" "\Centerstack{More \! Religious \! County}" "\Centerstack{Less \! Sexist \! State}" "\Centerstack{More \! Sexist \! State}")  cells("mean( fmt(2) )") replace 
}



* ---------------------- Table A.2 -------------------------- * 
gen OtherSchools=0
replace OtherSchools=1 if Elementary+Middle+High==1
	
global Demos "OtherSchools Elementary Middle High DMFem PublicNOTCharter PublicCharter Private"
global Treats "MaleHigh FemaleLow MaleLow FemaleHigh"
		foreach Demo in $Demos {
		foreach Treat in $Treats {
		gen `Demo'_`Treat'=`Treat'*`Demo'
		}
		}

label var OtherSchools "Other Schools"

label var DMFem_MaleHigh "Decison-Maker Female * MaleHigh"
label var DMFem_MaleLow "Decison-Maker Female * MaleLow"
label var DMFem_FemaleHigh "Decison-Maker Female * FemaleHigh"
label var DMFem_FemaleLow "Decison-Maker Female * FemaleLow"

label var PublicNOTCharter_MaleHigh "Public (non-Charter) * MaleHigh"
label var PublicNOTCharter_MaleLow "Public (non-Charter) * MaleLow"
label var PublicNOTCharter_FemaleHigh "Public (non-Charter) * FemaleHigh"
label var PublicNOTCharter_FemaleLow "Public (non-Charter) * FemaleLow"
		
label var PublicCharter_MaleHigh "Public (Charter) * MaleHigh"
label var PublicCharter_MaleLow "Public (Charter) * MaleLow"
label var PublicCharter_FemaleHigh "Public (Charter) * FemaleHigh"
label var PublicCharter_FemaleLow "Public (Charter) * FemaleLow"

label var OtherSchools_MaleHigh "Other Schools * MaleHigh"
label var OtherSchools_MaleLow "Other Schools * MaleLow"
label var OtherSchools_FemaleHigh "Other Schools * FemaleHigh"
label var OtherSchools_FemaleLow "Other Schools * FemaleLow"

label var Middle_MaleHigh "Middle * MaleHigh"
label var Middle_MaleLow "Middle * MaleLow"
label var Middle_FemaleHigh "Middle * FemaleHigh"
label var Middle_FemaleLow "Middle * FemaleLow"
		
label var High_MaleHigh "High * MaleHigh"
label var High_MaleLow "High * MaleLow"
label var High_FemaleHigh "High * FemaleHigh"
label var High_FemaleLow "High * FemaleLow"


reg NoCall OtherSchools Middle High DMFem PublicNOTCharter PublicCharter MaleHigh FemaleLow MaleLow FemaleHigh OtherSchools_* Middle_* High_* DMFem_* PublicNOTCharter_* PublicCharter_*  [aweight=a_weight] if Main==1, robust
estimates store Main_SelectCall 
reg NoCall OtherSchools Middle High DMFem PublicNOTCharter PublicCharter  MaleHigh FemaleLow MaleLow FemaleHigh OtherSchools_* Middle_* High_* DMFem_* PublicNOTCharter_* PublicCharter_*  [aweight=a_weight] if Exp==1, robust 
estimates store Exp_SelectCall
reg NoCall OtherSchools Middle High DMFem PublicNOTCharter PublicCharter  MaleHigh FemaleLow MaleLow FemaleHigh OtherSchools_* Middle_* High_* DMFem_* PublicNOTCharter_* PublicCharter_*  [aweight=a_weight] if FT==1, robust 
estimates store FT_SelectCall
reg NoCall OtherSchools Middle High DMFem PublicNOTCharter PublicCharter  MaleHigh FemaleLow MaleLow FemaleHigh OtherSchools_* Middle_* High_* DMFem_* PublicNOTCharter_* PublicCharter_*  [aweight=a_weight] if Pay==1, robust 
estimates store Pay_SelectCall


esttab Main_SelectCall Exp_SelectCall FT_SelectCall Pay_SelectCall using "$tables/Table_A2.tex", replace cells(b(star fmt($dec))  se(par fmt($dec))) starlevels( + 0.10 * 0.05 ** 0.010 *** 0.001)   style(tex) label  ///
mtitle("Baseline" "Equal Decision" "Full-Time" "Pay") ///
 scalars("controls Control Variables" "b1 \hline" "r2_a R$^2 $") sfmt($dec)  collabels(none) obslast

* ---------------------------------------------------------------------- *


//Appendix figures in order of appearance

//Multiple Logit Models with different outcomes
gen alt_outcome=0 if outcome==0
		replace alt_outcome=1 if outcome==2
		replace alt_outcome=2 if outcome==1
		
	mlogit outcome MaleHigh FemaleLow MaleLow FemaleHigh if Main==1 [pw=p_weight], robust
	estimates store mlogit_Main
	
	margins, eyex(*) predict(outcome(2))
	marginsplot, title(" ")  xtitle(" ") xlabel(, angle(45) ) ytitle("EyEx Effects on Pr(Call Male)") name(CallMemaleeyex)
	margins, eyex(*) predict(outcome(1))
	marginsplot, title(" ")  xtitle(" ") xlabel(, angle(45) ) ytitle("EyEx Effects on Pr(Call Female)") name(CallFemaleeyex)
	margins, eyex(*) predict(outcome(0))
	marginsplot, title(" ")  xtitle(" ") xlabel(, angle(45) ) ytitle("EyEx Effects on Pr(Call No One)") name(CallNooneeyex)
	graph combine CallMemaleeyex CallFemaleeyex CallNooneeyex, ycommon col(3) 
	graph export "$figures/Figure_B1_A.png", as(png) replace
	
	mlogit outcome MaleHigh FemaleLow MaleLow FemaleHigh if Exp==1 [pw=p_weight], robust
	estimates store mlogit_Exp

	margins, eyex(*) predict(outcome(2))
	marginsplot, title(" ")  xtitle(" ") xlabel(, angle(45) ) ytitle("EyEx Effects on Pr(Call Male)") name(CallMemaleeyexEXP)
	margins, eyex(*) predict(outcome(1))
	marginsplot, title(" ")  xtitle(" ") xlabel(, angle(45) ) ytitle("EyEx Effects on Pr(Call Female)") name(CallFemaleeyexEXP)
	margins, eyex(*) predict(outcome(0))
	marginsplot, title(" ")  xtitle(" ") xlabel(, angle(45) ) ytitle("EyEx Effects on Pr(Call No One)") name(CallNooneeyexEXP)
	graph combine CallMemaleeyexEXP CallFemaleeyexEXP CallNooneeyexEXP, ycommon col(3) 
	graph export "$figures/Figure_B1_B.png", as(png) replace	
	

gen DeepParamSample=0
	replace DeepParamSample=1 if Variation == 0 | Variation==2
	replace DeepParamSample=0 if Variation==0 & Treatment!=0
	replace DeepParamSample=0 if Variation==2 & Treatment==0

mlogit outcome MaleHigh FemaleLow MaleLow FemaleHigh if DeepParamSample==1 [pw=p_weight], robust
	estimates store mlogit_MainExp
	
	margins, eyex(*) predict(outcome(2))
	marginsplot, title(" ")  xtitle(" ") xlabel(, angle(45) ) ytitle("EyEx Effects on Pr(Call Male)") name(CallMemaleeyexMainEXP)
	margins, eyex(*) predict(outcome(1))
	marginsplot, title(" ")  xtitle(" ") xlabel(, angle(45) ) ytitle("EyEx Effects on Pr(Call Female)") name(CallFemaleeyexMainEXP)
	margins, eyex(*) predict(outcome(0))
	marginsplot, title(" ")  xtitle(" ") xlabel(, angle(45) ) ytitle("EyEx Effects on Pr(Call No One)") name(CallNooneeyexMainEXP)
	graph combine CallMemaleeyexMainEXP CallFemaleeyexMainEXP CallNooneeyexMainEXP, ycommon col(3) 
	*graph export "$figures/MainExpEyEx.png", as(png) replace		
		
esttab mlogit_Main mlogit_Exp using "$tables/Table_A1.tex", replace cells(b(star fmt($dec))  se(par fmt($dec))) starlevels( + 0.10 * 0.05 ** 0.010 *** 0.001)   style(tex) label  ///
	keep($treat_vars `RHS')  order($treat_vars _cons) scalars("controls Control Variables" "b1 /hline" "r2_a R$^2 $") sfmt($dec)  collabels(none) obslast
	
cd "$output"	

eststo CallSelect0: estpost sum $balance_stats_vars [aweight=a_weight] if NoCall==0
eststo CallSelect1: estpost sum $balance_stats_vars  [aweight=a_weight] if NoCall==1

sum FemaleEmail  [aweight=a_weight] if NoCall==0
sum FemaleEmail  [aweight=a_weight] if NoCall==1
reg FemaleEmail NoCall [aweight=a_weight]

sum FemaleEmail  if NoCall==0
sum FemaleEmail  if NoCall==1
reg FemaleEmail NoCall 


//------------Deep Parameters
//3. Signal value
gen x_M=0
	replace x_M=1 if MaleHigh==1
	replace x_M=-1 if MaleLow==1

gen x_F=0	
	replace x_F=1 if FemaleHigh==1
	replace x_F=-1 if FemaleLow==1
	
//4. Any signal sent indicator
gen any_msg_M = 0
	replace any_msg_M = 1 if MaleHigh==1
	replace any_msg_M = 1 if MaleLow==1	
	
gen any_msg_F = 0
    replace any_msg_F = 1 if FemaleHigh==1
	replace any_msg_F = 1 if FemaleLow==1
	
//5. Reply-to-sender variable
gen rts = FemaleEmail
	replace rts = -1 if FemaleEmail ==0
	
gen rts_mh = rts*MaleHigh
gen rts_ml = rts*MaleLow
gen rts_fh = rts*FemaleHigh
gen rts_fl = rts*FemaleLow
gen rts_b = rts - rts_mh - rts_ml - rts_fh - rts_fl

label var x_M "\$x_M$ (Male Signal Pos/Neg)"
label var x_F "\$x_F$ (Female Signal Pos/Neg)"
label var any_msg_M "Any Signal About Male"
label var any_msg_F "Any Signal About Female"
label var rts_mh "reply-to-sender*MaleHigh"
label var rts_ml "reply-to-sender*MaleLow"
label var rts_fh "reply-to-sender*FemaleHigh"
label var rts_fl "reply-to-sender*FemaleLow"
label var rts_b "reply-to-sender*NoSignal"
label var rts "reply-to-sender"

//Create interactions between treatments & FemaleEmail / rts
gen MaleEmail=1-FemaleEmail
global treat_vars2 "FemaleHigh MaleHigh FemaleLow MaleLow  Baseline"	
foreach treat in $treat_vars2  {
gen FemEmail`treat'=FemaleEmail*`treat'
gen MalEmail`treat'=MaleEmail*`treat'
gen rts`treat'=rts*`treat'
}	

foreach var in $Var {	
svy: reg FemaleNum MaleHigh FemaleLow Baseline MaleLow FemaleHigh rtsMaleHigh rtsFemaleLow rtsMaleLow rtsFemaleHigh rtsBaseline if `var'==1, noconstant
estimates store `var'_FemaleNum_rts
svy: reg FemaleNum MaleHigh FemaleLow Baseline MaleLow FemaleHigh FemEmailMaleHigh FemEmailFemaleLow FemEmailBaseline FemEmailMaleLow FemEmailFemaleHigh  if `var'==1, noconstant
estimates store `var'_FemaleNum_FemEmail
svy: reg MaleNum MaleHigh FemaleLow Baseline MaleLow FemaleHigh MalEmailMaleHigh MalEmailFemaleLow MalEmailMaleLow MalEmailFemaleHigh MalEmailBaseline if `var'==1, noconstant
estimates store `var'_MaleNum_FemEmail
}

 

esttab Main_FemaleNum_FemEmail Exp_FemaleNum_FemEmail using "$tables/Table_A4_A.tex", replace cells(b(star fmt($dec))  se(par fmt($dec))) starlevels( + 0.10 * 0.05 ** 0.010 *** 0.001)   style(tex) label  ///
 scalars("controls Control Variables" "b1 \hline" "r2_a R$^2 $") sfmt($dec)  collabels(none) obslast

 esttab Main_MaleNum_FemEmail Exp_MaleNum_FemEmail using "$tables/Table_A4_B.tex", replace cells(b(star fmt($dec))  se(par fmt($dec))) starlevels( + 0.10 * 0.05 ** 0.010 *** 0.001)   style(tex) label  ///
 scalars("controls Control Variables" "b1 \hline" "r2_a R$^2 $") sfmt($dec)  collabels(none) obslast
 
**NOTE: Switched from [aweight=a_weight] to [pweight=a_weight] from logit models "aweight not allowed"
 
mlogit WhoCalled any_msg_M x_M any_msg_F x_F rts_mh rts_ml rts_fh rts_fl rts_b [pweight=p_weight] if DeepParamSample==1, base(0)	
	estimates store RegDeepParam

***** generate in text numbers under "Drivers of the Gender Inequality" ****

* In the No Signal treatment, we estimate the utility gain from calling the parent who sends the email to be 2.51
display _b[Female_Call:rts_b] - _b[Male_Call:rts_b]

* For the case when the female parent sends the email, there is a gain of 0.791 from calling the mother, and a
* penalty of 1.722 from calling the father relative to calling neither parent.
display _b[Female_Call:rts_b]
display _b[Male_Call:rts_b]

*  The utility difference is both economically and statistically significantly different from zero (Prob > chi2 = 0.000)
test [Female_Call]rts_b = [Male_Call]rts_b

* Our parameter estimate for the expected value of a response from female parents is q f r f = −0.341
display - _b[Female_Call:any_msg_F]/_b[Female_Call:x_F]

* which is higher than the analogous parameter for male parents qmrm = −0.968
display - _b[Male_Call:any_msg_M]/_b[Male_Call:x_M]

* This difference is statistically significant (Prob > chi2 = 0.013)
testnl - _b[Female_Call:any_msg_F]/_b[Female_Call:x_F] = - _b[Male_Call:any_msg_M]/_b[Male_Call:x_M]

* our parameter estimate for the residual term for male parents is greater than that for female parents; that is, δm − δf = 0.536 (Prob > chi2 = 0.002)
* our parameter estimate for the residual term for male parents is greater than that for female parents; that is, δm − δf = 0.536 (Prob > chi2 = 0.002)
display -1*_b[Female_Call:any_msg_F]/_b[Female_Call:x_F] - _b[Female_Call:_cons] - [(-1*_b[Male_Call:any_msg_M]/_b[Male_Call:x_M]) - _b[Male_Call:_cons]]

testnl (-1*_b[Female_Call:any_msg_F]/_b[Female_Call:x_F]) - _b[Female_Call:_cons]=(-1*_b[Male_Call:any_msg_M]/_b[Male_Call:x_M]) - _b[Male_Call:_cons]
	
mlogit WhoCalled MaleHigh FemaleHigh MaleLow FemaleLow rts_mh rts_ml rts_fh rts_fl rts_b  if DeepParamSample==1, base(0)	
	estimates store RegDeepParam2	
	
cd "$output"	
global dec "2"
esttab RegDeepParam RegDeepParam2 using "$tables/Table_A3.tex", replace cells(b(star fmt($dec))  se(par fmt($dec))) starlevels( + 0.10 * 0.05 ** 0.010 *** 0.001)   style(tex) label  ///
	mtitle("No Call Base" ) ///
	scalars("b1 \hline") sfmt($dec)  collabels(none) obslast		

*** MultiCallOutcomesByTreat ***
bysort lemail: egen CallsToFemale=total(FemaleNum0)
bysort lemail: egen CallsToMale=total(MaleNum0)


******************************** Tables C1, C2, F1, F2 *****************************************			
//------------Balance Table
		* set decimal places to round
		global dec=2

		cd "$output"
		foreach var in $Var {
		forvalues i=0/4 {
		eststo `var'_s`i': estpost sum $balance_stats_vars if Treatment==`i'&`var'==1
		eststo `var'_s`i'_w: estpost sum $balance_stats_vars [aweight=a_weight] if Treatment==`i'&`var'==1
		eststo `var'_s`i'_alt: estpost sum $balance_stats_vars if Treatment==`i'&`var'==1&AltDataSet==1
		}
		}

		global PublicVars "FreeLunch White Black Hispanic"
		foreach PublicVar in $PublicVars {
		cap gen Pub_`PublicVar'=`PublicVar'
			replace Pub_`PublicVar'=0 if `PublicVar'==.
		}
		
esttab Main_s1_w Main_s4_w Main_s0_w Main_s2_w Main_s3_w  using "$tables/Table_C1.tex", ///
	label  mtitle("High Male (Hm)" "Low Female (Lf)" "Baseline (b)" "Low Male (Lm)" "High Female (Hf)") ///
	nodepvars collabels(none) cells("mean( fmt(2) )") replace 	

esttab Exp_s1_w Exp_s4_w Exp_s0_w Exp_s2_w Exp_s3_w  using "$tables/Table_C2.tex", ///
	label  mtitle("High Male (Hm)" "Low Female (Lf)" "Baseline (b)" "Low Male (Lm)" "High Female (Hf)") ///
	nodepvars collabels(none) cells("mean( fmt(2) )") replace 	
	
	
esttab FT_s1_w FT_s4_w FT_s0_w FT_s2_w FT_s3_w  using "$tables/Table_F1.tex", ///
	label  mtitle("High Male (Hm)" "Low Female (Lf)" "Baseline (b)" "Low Male (Lm)" "High Female (Hf)") ///
	nodepvars collabels(none) cells("mean( fmt(2) )") replace 	

esttab Pay_s1_w Pay_s4_w Pay_s0_w Pay_s2_w Pay_s3_w  using "$tables/Table_F2.tex", ///
	label  mtitle("High Male (Hm)" "Low Female (Lf)" "Baseline (b)" "Low Male (Lm)" "High Female (Hf)") ///
	nodepvars collabels(none) cells("mean( fmt(2) )") replace 
	
	
********************************************************************************************************


//By Decision-Maker Gender
graph bar (mean) FemaleNum0 (mean) MaleNum0 (mean) NoCall [aweight=a_weight] if Variation==0, over(DMFem, label(angle(50))) over(Treatment, gap(*1) sort(order) relabel(1 "No Signal" 2 `" "High Male" "Availability" "' 3 `" "Low Male" "Availability" "' 4 `" "High Female" "Availability" "' 5 `""Low Female" "Availability""') label(angle(0))) stack bar(1, fcolor(orange) lcolor(orange)) bar(2, fcolor(ltblue%70) lcolor(ltblue))  bar(3, fcolor(green) lcolor(green))  ytitle(Proportion) ylab(,nogrid) legend(order(1 "Called Female (Mom)" 2 "Called Male (Dad)" 3 "No Call") row(1))	
			graph export "$figures/FigureD1_A.png", as(png) replace
			
graph bar (mean) FemaleNum (mean) MaleNum [aweight=a_weight] if Variation==0, yline(0.5) over(DMFem, label(angle(50))) over(Treatment, gap(*1) sort(order) relabel(1 "No Signal" 2 `" "High Male" "Availability" "' 3 `" "Low Male" "Availability" "' 4 `" "High Female" "Availability" "' 5 `""Low Female" "Availability""') label(angle(0))) stack bar(1, fcolor(orange) lcolor(orange)) bar(2, fcolor(ltblue%70) lcolor(ltblue)) title(Conditional on Calling) ytitle(Proportion) ylab(,nogrid) legend(order(1 "Called Female (Mom)" 2 "Called Male (Dad)"))
		graph export "$figures/FigureD1_B.png", as(png) replace

graph bar (mean) FemaleNum0 (mean) MaleNum0 (mean) NoCall [aweight=a_weight] if Exp==1, over(DMFem, label(angle(50))) over(Treatment, gap(*1) sort(order) relabel(1 "No Signal" 2 `" "High Male" "Availability" "' 3 `" "Low Male" "Availability" "' 4 `" "High Female" "Availability" "' 5 `""Low Female" "Availability""') label(angle(0))) stack bar(1, fcolor(orange) lcolor(orange)) bar(2, fcolor(ltblue%70) lcolor(ltblue))  bar(3, fcolor(green) lcolor(green))  ytitle(Proportion) ylab(,nogrid) legend(order(1 "Called Female (Mom)" 2 "Called Male (Dad)" 3 "No Call") row(1))	
			graph export "$figures/FigureD2_A.png", as(png) replace
			
	graph bar (mean) FemaleNum (mean) MaleNum [aweight=a_weight] if Exp==1, yline(0.5) over(DMFem, label(angle(50))) over(Treatment, gap(*1) sort(order) relabel(1 "No Signal" 2 `" "High Male" "Availability" "' 3 `" "Low Male" "Availability" "' 4 `" "High Female" "Availability" "' 5 `""Low Female" "Availability""') label(angle(0))) stack bar(1, fcolor(orange) lcolor(orange)) bar(2, fcolor(ltblue%70) lcolor(ltblue)) title(Conditional on Calling) ytitle(Proportion) ylab(,nogrid) legend(order(1 "Called Female (Mom)" 2 "Called Male (Dad)"))
		graph export "$figures/FigureD2_B.png", as(png) replace

//Experts vs. Main by School Grade Level
graph bar (mean) FemaleNum0 (mean) MaleNum0 (mean) NoCall [aweight=a_weight_Elementary] if (Variation==0|Variation==2)&Elementary==1, over(Variation, label(angle(50))) over(Treatment, gap(*1) sort(order) relabel(1 "No Signal" 2 `" "High Male" "Availability" "' 3 `" "Low Male" "Availability" "' 4 `" "High Female" "Availability" "' 5 `""Low Female" "Availability""') label(angle(0))) stack bar(1, fcolor(orange) lcolor(orange)) bar(2, fcolor(ltblue%70) lcolor(ltblue)) bar(3, fcolor(green) lcolor(green)) ytitle(Proportion) ylab(,nogrid) legend(order(1 "Called Female (Mom)" 2 "Called Male (Dad)" 3 "No Call") row(1))	
			graph export "$figures/FigureE1_A.png", as(png) replace

graph bar (mean) FemaleNum0 (mean) MaleNum0 (mean) NoCall [aweight=a_weight_Middle] if (Variation==0|Variation==2)&Middle==1, over(Variation, label(angle(50))) over(Treatment, gap(*1) sort(order) relabel(1 "No Signal" 2 `" "High Male" "Availability" "' 3 `" "Low Male" "Availability" "' 4 `" "High Female" "Availability" "' 5 `""Low Female" "Availability""') label(angle(0))) stack bar(1, fcolor(orange) lcolor(orange)) bar(2, fcolor(ltblue%70) lcolor(ltblue)) bar(3, fcolor(green) lcolor(green)) ytitle(Proportion) ylab(,nogrid) legend(order(1 "Called Female (Mom)" 2 "Called Male (Dad)" 3 "No Call") row(1))	
			graph export "$figures/FigureE1_B.png", as(png) replace
			
graph bar (mean) FemaleNum0 (mean) MaleNum0 (mean) NoCall [aweight=a_weight_High] if (Variation==0|Variation==2)&High==1, over(Variation, label(angle(50))) over(Treatment, gap(*1) sort(order) relabel(1 "No Signal" 2 `" "High Male" "Availability" "' 3 `" "Low Male" "Availability" "' 4 `" "High Female" "Availability" "' 5 `""Low Female" "Availability""') label(angle(0))) stack bar(1, fcolor(orange) lcolor(orange)) bar(2, fcolor(ltblue%70) lcolor(ltblue)) bar(3, fcolor(green) lcolor(green)) ytitle(Proportion) ylab(,nogrid) legend(order(1 "Called Female (Mom)" 2 "Called Male (Dad)" 3 "No Call") row(1))	
			graph export "$figures/FigureE1_C.png", as(png) replace

//Both Full Time vs. Main
graph bar (mean) FemaleNum0 (mean) MaleNum0 (mean) NoCall [aweight=a_weight] if Variation==0|Variation==3, over(Variation, label(angle(50))) over(Treatment, gap(*1) sort(order) relabel(1 "No Signal" 2 `" "High Male" "Availability" "' 3 `" "Low Male" "Availability" "' 4 `" "High Female" "Availability" "' 5 `""Low Female" "Availability""') label(angle(0))) stack bar(1, fcolor(orange) lcolor(orange)) bar(2, fcolor(ltblue%70) lcolor(ltblue))  bar(3, fcolor(green) lcolor(green))  ytitle(Proportion) ylab(,nogrid) legend(order(1 "Called Female (Mom)" 2 "Called Male (Dad)" 3 "No Call") row(1))	
			graph export "$figures/FigureF1_A.png", as(png) replace

graph bar (mean) FemaleNum (mean) MaleNum [aweight=a_weight] if Variation==0|Variation==3, yline(0.5) over(Variation, label(angle(50))) over(Treatment, gap(*1) sort(order) relabel(1 "No Signal" 2 `" "High Male" "Availability" "' 3 `" "Low Male" "Availability" "' 4 `" "High Female" "Availability" "' 5 `""Low Female" "Availability""') label(angle(0))) stack bar(1, fcolor(orange) lcolor(orange)) bar(2, fcolor(ltblue%70) lcolor(ltblue)) ytitle(Proportion) ylab(,nogrid) legend(order(1 "Called Female (Mom)" 2 "Called Male (Dad)"))
		graph export "$figures/FigureF1_B.png", as(png) replace

//Payments vs. Main
	graph bar (mean) FemaleNum0 (mean) MaleNum0 (mean) NoCall [aweight=a_weight] if Variation==0|Variation==1, over(Variation, label(angle(50))) over(Treatment, gap(*1) sort(order) relabel(1 "No Signal" 2 `" "High Male" "Availability" "' 3 `" "Low Male" "Availability" "' 4 `" "High Female" "Availability" "' 5 `""Low Female" "Availability""') label(angle(0))) stack bar(1, fcolor(orange) lcolor(orange)) bar(2, fcolor(ltblue%70) lcolor(ltblue)) bar(3, fcolor(green) lcolor(green))  ytitle(Proportion) ylab(,nogrid) legend(order(1 "Called Female (Mom)" 2 "Called Male (Dad)" 3 "No Call") row(1))	
			graph export "$figures/FigureF2_A.png", as(png) replace	

graph bar (mean) FemaleNum (mean) MaleNum [aweight=a_weight] if Variation==0|Variation==1, yline(0.5) over(Variation, label(angle(50))) over(Treatment, gap(*1) sort(order) relabel(1 "No Signal" 2 `" "High Male" "Availability" "' 3 `" "Low Male" "Availability" "' 4 `" "High Female" "Availability" "' 5 `""Low Female" "Availability""') label(angle(0))) stack bar(1, fcolor(orange) lcolor(orange)) bar(2, fcolor(ltblue%70) lcolor(ltblue))  ytitle(Proportion) ylab(,nogrid) legend(order(1 "Called Female (Mom)" 2 "Called Male (Dad)"))
		graph export "$figures/FigureF2_B.png", as(png) replace
